import './lodash_fix'
let _ = require("./lodash.min");

module.exports = async (path, method = "POST", data) => {
  const res = await wx.cloud.callContainer({
    config: {
      env: "ymk-community-3g3m9sm8a3fa5713",
    },
    path,
    method,
    header: {
      "X-WX-SERVICE": "dev-community-web",
    },
    data,
  });
  if (res.statusCode !== 200) {
    wx.showToast({
      title: _.get(res, "data.msg", "未知错误"),
      icon: "error",
      duration: 2000,
    });
  }
  return res;
};
